package com.itheima.service.impl;

import com.itheima.dao.StudentDao;
import com.itheima.dao.impl.StudentDaoImpl;
import com.itheima.domain.Student;
import com.itheima.service.StudentService;

public class StudentServiceImpl implements StudentService {
    StudentDaoImpl studentDao = new StudentDaoImpl();
    @Override
    public void addStudent(Student student) {
        studentDao.addStudent(student);
    }

    @Override
    public boolean isExists(String id) {
        int index = studentDao.selectStudent(id);
       if (index != -1)
           return true;
        return false;
    }

    @Override
    public void delectStudent(String id) {
        studentDao.delectStudent(id);
    }

    @Override
    public Student updataStudent(Student student) {
        Student stu = studentDao.updataStudent(student);
        return stu;
    }

    @Override
    public Student[] findAllStudent() {
        Student[] allStudents = studentDao.findAllStudents();
        return allStudents;
    }
}
